package com.fjnldx.mes.controller.energy;

import com.fjnldx.mes.domain.domainRes.QueryResult;
import com.fjnldx.mes.domain.domainRes.Result;
import com.fjnldx.mes.domain.energy.req.LSSJReq;
import com.fjnldx.mes.domain.energy.req.SSCXReq;
import com.fjnldx.mes.service.energy.EnergyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/energy")
@Api(value = "能源管理", tags = "能源管理")
public class EnergyController {

    @Resource
    EnergyService service;

    @GetMapping("/queryKongTiao")
    @ApiOperation(value = "空调电耗", notes = "空调电耗")
    public Result queryKongTiao() {
        return service.queryKongTiao();
    }

    @GetMapping("/queryKongYa")
    @ApiOperation(value = "空压电耗", notes = "空压电耗")
    public Result queryKongYa() {
        return service.queryKongYa();
    }

    @PostMapping("/querySSCX")
    @ApiOperation(value = "实时查询", notes = "实时查询")
    public Result querySSCX(@RequestBody SSCXReq req) {
        return service.querySSCX(req);
    }

    @PostMapping("/queryHistoryCjList")
    @ApiOperation(value = "历史查询-参数：生产车间、工序列表", notes = "获取车间、工序列表，作为历史查询的参数")
    public Result queryCjAndGongXuList() {
        Result result = service.queryCjAndGongXuList();
        return result;
    }

    @PostMapping("/queryHistory")
    @ApiOperation(value = "历史查询", notes = "历史查询")
    public QueryResult queryHistory(@RequestBody LSSJReq req) {

        QueryResult result = service.queryHistory(req);
        return result;
    }
}
